/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mygame;

import com.jme3.bullet.BulletAppState;
import com.jme3.bullet.collision.shapes.BoxCollisionShape;
import com.jme3.bullet.collision.shapes.CylinderCollisionShape;
import com.jme3.bullet.control.GhostControl;
import com.jme3.bullet.control.RigidBodyControl;
import com.jme3.math.Vector3f;
import com.jme3.scene.Spatial;

/**
 *
 * @author Peter
 */
public class Minion {
    
    protected Spatial minion;
    protected Main mainApp;
    protected RigidBodyControl minionBody;
    protected BoxCollisionShape minionShape;
    
    Minion( float size, Vector3f coords, Main main){
    
        //app.getStateManager().attach(this);
        //super.initialize(mainApp.getStateManager(), app);
        
        //this.setEnabled(true);
        mainApp = main;
        minion = mainApp.getAssetManager().loadModel("Models/veza/tower.j3o");
        
         minion.setLocalTranslation(coords.x, coords.y, coords.z);
         minion.scale(size, size, size);
        minionShape = new BoxCollisionShape(new Vector3f(size, size, size));
        minionBody = new RigidBodyControl( minionShape);
    
        //towerRangeControl.setApplyPhysicsLocal(true);
        //towerRangeControl.setPhysicsLocation(new Vector3f(0f, 100.0f, 0f));
        
        minion.addControl(minionBody);
        
        mainApp.getStateManager().getState(BulletAppState.class).getPhysicsSpace().add(minionBody);
       //rangeShape.(new Vector3f(10.0f, 5.0f, 0.0f));
        mainApp.getRootNode().attachChild(minion);
    }
    
    public Spatial getMinion()
    {
        return minion;
    }
}
